package cn.edu.sjtu.se.peakfactory.service.bean;

import java.util.Date;
import java.util.List;

import cn.edu.sjtu.se.lchang.socialnetwork.dao.bean.Location;
import cn.edu.sjtu.se.lchang.socialnetwork.service.bean.LocationVB;
import cn.edu.sjtu.se.peakfactory.dao.bean.Coupon;
import cn.edu.sjtu.se.peakfactory.dao.bean.Formula;

public class CouponVB {
	private Long id;
	private String name;
	private String detail;
	private Date startTime;
	private Date dueTime;
	private List<LocationVB> locationVBs;
	private List<FormulaVB> formulaVBs;
	private Integer count;
	private Integer used;
	private Integer status;

	public CouponVB(Coupon coupon) {
		id = coupon.getId();
		name = coupon.getName();
		detail = coupon.getDetail();
		startTime = coupon.getStartTime();
		dueTime = coupon.getDueTime();

		if (coupon.getLocations() != null) {
			for (Location l : coupon.getLocations()) {
				locationVBs.add(new LocationVB(l));
			}
		}
		if (coupon.getFormulas() != null) {
			for (Formula f : coupon.getFormulas()) {
				formulaVBs.add(new FormulaVB(f));
			}
		}
		count = coupon.getCount();
		used = coupon.getUsed();
		status = coupon.getStatus();
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDetail() {
		return detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getDueTime() {
		return dueTime;
	}

	public void setDueTime(Date dueTime) {
		this.dueTime = dueTime;
	}

	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	public Integer getUsed() {
		return used;
	}

	public void setUsed(Integer used) {
		this.used = used;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public List<FormulaVB> getFormulaVBs() {
		return formulaVBs;
	}

	public void setFormulaVBs(List<FormulaVB> formulaVBs) {
		this.formulaVBs = formulaVBs;
	}

	public List<LocationVB> getLocationVBs() {
		return locationVBs;
	}

	public void setLocationVBs(List<LocationVB> locationVBs) {
		this.locationVBs = locationVBs;
	}

}
